package com.honey.mybatis.generator.condition.method;

import com.honey.compilation.java.Clazz;
import com.honey.compilation.java.JavaKeyWord;
import com.honey.compilation.java.Parameter;
import com.honey.core.dbmapping.introspect.IntrospectSchema;
import com.honey.core.dbmapping.introspect.IntrospectSchemaColumn;
import com.honey.core.types.JDKFullyQualifiedJavaType;
import com.honey.mybatis.generator.AbstractMethod;
import com.honey.mybatis.generator.MybatisPlugin;
import com.honey.mybatis.generator.condition.ConditionConstant;

/**
 * clear 函数
 * @author Administrator
 *
 */
public class SetDistinctMethod extends AbstractMethod {
	
	public SetDistinctMethod(){
	}
	public SetDistinctMethod(Clazz clazz, MybatisPlugin belongPlugin,
			IntrospectSchema introspectSchema,
			IntrospectSchemaColumn introspectSchemaColumn) {
		super(clazz, belongPlugin, introspectSchema, introspectSchemaColumn);
	}
	/** 方法名称 */
	private static final String METHOD_NAME ="setDistinct";
	
	/** 变量名称 */
	private static final String VARIABLE_NAME="distinct" ;
	
	/** 方法体 */
	private static final String[] METHOD_BODY =new String[]{
		JavaKeyWord.OPERATION_THIS + ConditionConstant.DISTINCT + " = "+VARIABLE_NAME	
	};
	
	/** 参数 */
	private static final Parameter[] PARAMETER= new Parameter[]{
		new Parameter(JDKFullyQualifiedJavaType.getBoolInstance(),VARIABLE_NAME)
	};
	
	/** 方法注释 */
	private static final String[] JAVA_DOC = new String []{
		"设定是否去除重复列, true:是 false:否。"
	};
	
	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getMethodName()
	 */
	@Override
	protected String getMethodName() {
		return METHOD_NAME;
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getBody()
	 */
	@Override
	protected String[] getBody() {
		return METHOD_BODY;
	}

	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getJavaDoc()
	 */
	@Override
	protected String[] getJavaDoc() {
		return JAVA_DOC;
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getParameter()
	 */
	@Override
	protected Parameter[] getParameter() {
		
		return PARAMETER;
	}
	public static void main(String []args){
		SetDistinctMethod  cm = new SetDistinctMethod();
		System.out.println(cm.createMethod().compiledContent(0)); 
	}
}
